#ifndef GraphicsView_H
#define GraphicsView_H

#include <QQuickWindow>
#include <QtGui/QOpenGLFunctions>

class QPainter;
class QOpenGLContext;
class QOpenGLPaintDevice;
class GraphicsItem;
class GraphicsScene;

class QUINCE_GUI_EXPORT GraphicsView : public QWindow, protected QOpenGLFunctions
{
    Q_OBJECT
public:
    explicit GraphicsView(QWindow *parent = 0);
    virtual ~GraphicsView();

    virtual void render();
    virtual void initialize();

    void addItem(GraphicsItem * item);
    void removeItem(GraphicsItem * item);

    GraphicsScene * scene() const { return m_scene; }
    void setScene(GraphicsScene *sc);

public slots:
    void renderNow();
protected:
    bool event(QEvent *event);

    void exposeEvent(QExposeEvent *event);

private:
    QOpenGLContext *m_context;
    QOpenGLPaintDevice *m_device;

    GraphicsScene * m_scene;

    typedef list<GraphicsItem *> GraphicsItemList;
    GraphicsItemList m_items;
};

#endif // GraphicsView_H
